$(function () {
    $.ajax({
        url: "/menu/list", //请求控制层接口
        cache: false,
        async: false,
        type: 'GET',
        success: function (data) {
            //console.log(JSON.stringify(data[0].menuName));//"首 页"
            if(data != undefined && data.length > 0){
                var menu = [];
                var menuUrl = [];
            }
            for (var i = 0; i < data.length; i++){
                menu[i] = data[i].menuName;
                menuUrl[i] = data[i].url;
            }
            //console.log(JSON.stringify(menu));
            //console.log(JSON.stringify(menuUrl));

            //添加菜单名称、请求地址
            var MyMenu = document.getElementById("MyMenu");
            var str = '';
            for (var i = 1; i < data.length; i++){
                str += '<li><a href="'+menuUrl[i]+'">'+menu[i]+'</a></li>';
            }
            MyMenu.innerHTML = str;
            
        },
        error: function (data) {
            alert(1);
        }
    });
});
